#!/usr/bin/env python
"""
# -*- coding: utf-8 -*-
# @Time    : 2020/9/30 13:16
# @Author  : AshJo
# @Desc    : 
# @Filename: client.py
# @Version : v1.0
"""

import socket

name = '小明'
sk = socket.socket(type=socket.SOCK_DGRAM)

while True:
    contect = input('>>>')
    if contect.upper() == 'Q':
        break
    contect = '%s|%s' % (name, contect)
    sk.sendto(contect.encode('utf-8'), ('127.0.0.1', 9000))
    msg = sk.recv(1024).decode('utf-8')
    if msg.upper() == 'Q':
        break
    print(msg)
